import { defineStore } from 'pinia';
import type { GlobalState } from '../interface';
export const useGlobalStore = defineStore('Global', {
  state: (): GlobalState => {
    return {
      language: null,
      iscollapsed: false,
      isactived: [],
      layout: 'vertical',
    };
  },
  actions: {
    changeGlobal(data: 'zh' | 'en') {
      this.language = data;
    },
    changecollapsed(state: boolean) {
      this.iscollapsed = state;
    },
    changeactived(key: string) {
      this.isactived = [key];
    },
    changeLayout(key: string) {
      this.layout = key;
    },
  },
  persist: true,
});
